<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Listagem de Funcionários</title>
</h:head>
<h:body>
	<h:form>
		<h:messages />

		<h:dataTable value="#{funcionarioBean.listarTodos()}" var="obj" frame="box" rules="all" cellpadding="3">

			<f:facet name="header">
				<h:commandButton action="#{funcionarioBean.novo()}" value="Novo Registro" />
			</f:facet>

			<h:column>
				<f:facet name="header">ID</f:facet>
				#{obj.id}
			</h:column>


			<h:column>
				<f:facet name="header">Nome</f:facet>
				#{obj.nome}
			</h:column>

			<h:column>
				<f:facet name="header">Grupo</f:facet>
				#{obj.grupo.nome}
			</h:column>

			<h:column>
				<f:facet name="header">Setor</f:facet>
				#{obj.setor.nome}
			</h:column>

			<h:column>
				<f:facet name="header">Foto</f:facet>
				<p:graphicImage value="#{funcionarioBean.imagemDinamica}" style="width:100px; height:100px" cache="false">
					<f:param name="id_imagem" value="#{obj.id}"></f:param>
				</p:graphicImage>

			</h:column>

			<h:column>
				<f:facet name="header">Alterar</f:facet>
				<h:commandLink action="#{funcionarioBean.alterar(obj)}" value="Alterar " />
			</h:column>

			<h:column>
				<f:facet name="header">Excluir</f:facet>
				<h:commandLink action="#{funcionarioBean.excluir(obj)}" value="Excluir"
					onclick="if(!confirm('Confirmar a exclusão do funcionário?')) return false;" />
			</h:column>
		</h:dataTable>
	</h:form>
</h:body>
</html>
